import requests
from http import cookiejar
url = 'http://192.168.1.240/login'
data = {
    'username':'admin',
    'password':'123123'
}
params = {
    'm':'loginAction'
}
#创建cookie
cookie = cookiejar.MozillaCookieJar('base.cookie')
#得到session
session = requests.session()
#设置cookie通过cookiejar来保存
session.cookies = cookie
#正常的登录的操作
resp = session.post(url,params=params,data=data)
print(cookie)
#保存登录信息
cookie.save(ignore_expires=True,ignore_discard=True)